package wymiana.dao;

import org.hibernate.Hibernate;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import wymiana.domain.School;

/**
 * 
 * @author Rafal Magdon
 * @version 1.0
 * 
 *          Description:
 * 
 */
@Repository
public class SchoolDao extends GenericDao<School> {

	@Autowired
	public SchoolDao(SessionFactory sf) {
		super(School.class, sf);
	}

	public School getSchoolById(Integer id) {
		School school = (School) getById(id);
		Hibernate.initialize(school.getCreateUser());
		Hibernate.initialize(school.getPhotos());
		// TODO inicjalizacja: kierunki itp
		return school;
	}

}
